

#include "mvfs.h"
#include <iostream>
#include "solid.h"
#include "hedmodel.h"
#include "face.h"
#include "loop.h"
#include "point.h"
#include "vertex.h"
#include "halfedge.h"


MVFS::MVFS(HEDModel& _model, int _s, int _f, int _v, double _x, double _y, double _z)
: newsolid( NULL )
, s( _s )
, f( _f )
, v( _v )
, x( _x )
, y( _y )
, z( _z )
{
  newsolid = new Solid(_model.getFirsts());
  _model.setFirsts( newsolid );
}




void
MVFS::execute()
{
  std::cout << "\nMVFS::execute() \n";
  Face* newface = new Face(newsolid);
  Loop* newloop = new Loop(newface);
  Point* point = new Point(x, y, z);
  Vertex* newvertex = new Vertex(point,newsolid);
  HalfEdge* newhe = new HalfEdge();
  newsolid->setSolidno(s);
  newface->setFaceno(f);
  // Original [MANT1988] code...
  //newface->setFlout( newloop );
  // Modified code...
  newface->setFlout( NULL );
  newloop->setLedg( newhe );
  newhe->setWloop(newloop);
  newhe->setNxt(newhe);
  newhe->setPrv(newhe);
  newhe->setVtx(newvertex);
  newhe->setEdg(NULL);
  newvertex->setVertexno(v);
  newvertex->setVedge(newhe);
}


void
MVFS::unExecute()
{
  std::cout << "\nMVFS::unExecute() NOT IMPLEMENTED!\n";
}


